//
//  HQMapPolylineOptionsModel.m
//  MJExtension
//
//  Created by Q神 on 2021/4/14.
//

#import "HQMapPolylineOptionsModel.h"

@implementation HQMapPolylineOptionsModel

+ (NSDictionary *)mj_objectClassInArray {
    return @{@"latLngList": @"LatLngModel"};
}

- (void)addPolyline:(MAMapView *)mapView {
    NSUInteger count = self.latLngList.count;
    CLLocationCoordinate2D coords[count];
    for (int i = 0; i < self.latLngList.count; i++) {
        LatLngModel *latLngModel = self.latLngList[i];
        coords[i].latitude = [latLngModel.latitude floatValue];
        coords[i].longitude = [latLngModel.longitude floatValue];
    }
    MAPolyline *polyline = [MAPolyline polylineWithCoordinates:coords count:count];
    [mapView addOverlay:polyline];
    
    /// 设置地图可见区域-路径显示在地图中心区域
    [mapView setVisibleMapRect:polyline.boundingMapRect];
}

@end
